home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d21
/
dv_guard.arc
/
DV-GUARD.ASM
next >
Wrap
Assembly Source File
|
1990-05-23
|
8KB
|
335 lines
page ,132
.model tiny
.code
first:
;
; DV-GUARD is an enhanced version of the marvelously written original
; WATCHCAT program created by Joseph R. Ahlgren.
; With his permission, it has been revised to allow use in
; the DESQview environment. In addition, due to popular request,
; the original "20 ring reboot" feature has been modified to
; reboot the system on 8 rings.
;
; Many people have contributed to this revised program. Quarterdeck
; Office Systems (the developers of DESQview), were certainly
; instrumental in making this version a success. In addition, the
; dedication of programmer Anthony Petillo was an absolute
; necessity to making this whole thing come about.
;
; For more information, please see DV-GUARD.DOC
;
;
;
; DV-GUARD performs 5 critical functions for any RBBS system
; running under DESQview:
;
; 1. Reboots the system if no carrier is detected in 8 hours.
; This catches RBBS or system failures.
;
; 2. Reboots the system if carrier is lost during critical period.
; This allows Doors to be used safely.
;
; 3. Reboots the system if 8 rings without answering phone.
; This allows system to be restarted by phone.
;
; 4. Reboots system if "Hit any key to return to system" message appears.
; This restarts system on an RBBS glitch.
;
; 5. Drops carrier if L&R shift keys pressed simultaneously.
; This allows users to be logged off without a nasty message.
;
;
; DV-GUARD loads the TSR and disables all functions
; DV-GUARD OFF disables all functions
; DV-GUARD ON enables 1,3,4,and 5
; DV-GUARD TIMER enables 2,4,and 5
;
;ComPort = 03f8h ;{COM1}
;ComPort = 02f8h ;{COM2}
;ComPort = 03e8h ;{COM3}
;ComPort = 02e8h ;{COM4}
;ScreenSegment = 0b800h ;{Color}
;ScreenSegment = 0b000h ;{Mono}
;
ModemStatus = 0006h
ModemControl = 0004h
CarrierDetect = 0080h
RingIndicator = 0040h
tpm = 1092 ; {ticks per minute}
RingTicks = 110; {6 seconds}
org 100h
start:
jmp init
RingTrigger dw 0
RingTimer db 0
Flag db 'F' and 0fh ; OFF ON TIME = F O I
TimerInt dd ?
Minutes dw 8*60 ;{minutes of no carrier to trigger reset}
Seconds dw tpm
MinReset dw 8*60
WarmBoot dd 0f000fff0h
ExitTimer db 0
DropTrigger db 3 ;Drop DTR on L&R shift
ExitMessage db 'Hit any key to return to system'
ExitMessageEnd db 0
ComPort dw 02f8h ;{COM2}
ScreenSegment dw 0b000h ;{Mono}
Ident db "jOeY"
Ident2 db "50c4"
timer:
assume ds:nothing,es:nothing,ss:nothing
cmp cs:[Flag],'F' and 0fh
jne SystemOn
jmp cs:[TimerInt]
SystemOn:
push ax
push dx
push ds
;
;
; 4. Reboots the system if "Hit any key to return to system" message appears.
; This restarts the system on an RBBS glitch.
;
dec cs:[ExitTimer]
jnz NoExitLoop
push cx
push si
push di
mov ax,cs:[ScreenSegment]
mov ds,ax
mov cx,25
xor si,si
SSLoop1:
push cx
push si
mov cx,ExitMessageEnd-ExitMessage
mov di,offset ExitMessage
SSLoop2:
lodsw
cmp al,cs:[di]
jne SSLoop2x
inc di
loop SSLoop2
jmp short NoCarrier
SSLoop2x:
pop si
pop cx
add si,160
loop SSLoop1
pop di
pop si
pop cx
NoExitLoop:
;
;
; 5. Drops carrier if L&R shift keys pressed simultaneously.
; This allows users to be logged off without a nasty message.
;
xor ax,ax
mov ds,ax
assume ds:Lowmem
mov al,[ShiftStatus]
and al,0fh
cmp al,cs:[DropTrigger]
jne NoShift
mov dx,cs:[ComPort]
add dx,ModemControl
in al,dx
and al,0feh
out dx,al ;drop DTR
NoShift:
;
;
; 3. Reboots the system if 8 rings without answering phone.
; This allows system to be restarted by phone.
;
mov dx,[ComPort]
add dx,ModemStatus
in al,dx
test al,RingIndicator
jz NotRinging
or cs:[RingTrigger],1
NotRinging:
dec cs:[RingTimer]
jnz NoRingTime
mov cs:[RingTimer],RingTicks
mov ax,cs:[RingTrigger]
cmp ax,0ffffh
je NoCarrier
shl ax,1
mov cs:[RingTrigger],ax
;
;
; 2. Reboots the system if carrier lost during critical period.
; This allows Doors to be used safely.
;
NoRingTime:
cmp cs:[Flag],'I' and 0fh
jb NoMonitor
je TimeCheck
in al,dx
and al,CarrierDetect
jz NoCarrier
NoMonitor:
pop ds
pop dx
pop ax
jmp cs:[TimerInt]
NoCarrier:
cli ; disable interrupts
mov ax,0 ; clear ax
mov ds,ax ; clear data seg reg
mov bx,0472h ; store 1234 at address 472
mov word ptr [bx],01234h
mov ss,ax ; clear stack seg reg
mov sp,0400h ; set stack ptr to 400
jmp cs:[warmboot] ; goto to warmboot area
;
;
; 1. Reboots the system if no carrier in specified period of time.
; This catches RBBS or system failures.
;
TimeCheck:
test al,CarrierDetect
jnz ResetTime
dec cs:[Seconds]
jnz NoMonitor
mov cs:[Seconds],tpm
dec cs:[Minutes]
jz NoCarrier
jmp short NoMonitor
ResetTime:
mov ax,cs:[MinReset]
mov cs:[Minutes],ax
jmp short NoMonitor
;
;
;
;
assume ds:@code,es:@code,ss:@code
init:
mov dx,offset SignOnMessage
mov ax,0900h
int 21h ;print load message
mov ax,[word ptr Ident2]
xor [word ptr Ident],ax
mov ax,[word ptr Ident2+2]
xor [word ptr Ident+2],ax
xor dx,dx
mov es,dx
mov si,offset Ident
mov cx,cs
mov ax,[si]
findloop:
cmp ax,es:[si]
jz found
NotQuite:
inc dx
mov es,dx
loop findloop
LoadDVGUARD:
xor bx,bx
mov es,bx
mov bl,ds:[82h]
cmp bl,'0'
jle NoCom
cmp bl,'4'
jle ComSpec
NoCom:
mov bl,'1'
ComSpec:
mov [ComPortNumber],bl
add bx,bx
mov ax,es:[bx+400h-31h-31h]
mov [ComPort],ax
cmp byte ptr ds:[83h],'C'
jnz NotColor
mov [ScreenSegment],0b800h
mov [ScreenSegNum],'8'
NotColor:
mov ax,3508h
int 21h ;get timer interrupt
mov [word ptr TimerInt],bx
mov [word ptr TimerInt+2],es
mov dx,offset Timer
mov ax,2508h
int 21h ;set timer interrupt
mov dx,offset message1
mov ax,0900h
int 21h ;print load message
mov dx,(init-first+15)/16
mov ax,3101h
int 21h ;TSR
Found:
mov bx,[si+2]
cmp bx,es:[si+2]
jnz NotQuite
mov ax,es
mov bx,10h
mov di,offset message2x
mov cx,4
loc:
mul bx
cmp dl,9
jbe locx
add dl,7
locx:
add dl,'0'
mov [di],dl
inc di
loop loc
mov ax,es:[MinReset]
mov es:[Minutes],ax
mov al,ds:[83h]
and al,0fh
mov es:[Flag],al
mov dx,offset message2tim
cmp al,'I' and 0fh
jz done
mov dx,offset message2off
jb done
mov dx,offset message2on
done:
push dx
mov dx,offset message2
mov ax,0900h
int 21h
pop dx
mov ax,0900h
int 21h
mov ax,4c00h
int 21h
message1 db 0ah,0dh,'DV-GUARD Loaded, set to COM'
ComPortNumber db '1 and Screen B'
ScreenSegNum db '000',0ah,0dh,'$'
message2 db 0ah,0dh,'DV-GUARD found at '
message2x db '0000 and set to $'
message2on db 'ON',0ah,0dh,'$'
message2off db 'OFF',0ah,0dh,'$'
message2tim db 'TIMER',0ah,0dh,'$'
SignOnMessage db 0dh,0ah,'DV-GUARD: RBBS protection when running under DESQview'
db ' ',0dh,0ah
db ' DV-GUARD may be freely distributed and/or modified. Enjoy!',0dh,0ah
db ' ',0dh,0ah
db ' Load with DV-GUARD ps, where p is the port number (1,2,3,4)',0dh,0ah
db ' and s is the screen type (Color or Mono), e.g., DV-GUARD 2C',0dh,0ah
db ' specifies COM2 and Color Screen',0ah,0dh
db ' ',0dh,0ah
db ' Subsequent calls are DV-GUARD ON, DV-GUARD OFF, and DV-GUARD TIMER',0dh,0ah
db ' OFF disables all functions',0dh,0ah
db ' ON reboots if carrier lost',0dh,0ah
db ' TIMER reboots if 8 rings without answering phone, if no carrier',0dh,0ah
db ' in 8 hours, or if "Hit any key to return to system" appears on screen',0dh,0ah
db ' Also, pressing both Left and Right Shift keys simultaneously will',0dh,0ah
db ' drop the line, logging off the current user.',0dh,0ah
db '$'
ends
Lowmem segment at 0000h
org 417h
ShiftStatus db ?
Lowmem ends
end start